char* sortSentence(char* s) {
    int lenS = (int)strlen(s);
    char* p[10];
    int pos = 0;
    char* temp = s;
    for (int i = 0; i < lenS; i++) {
        if (s[i] == ' ') {
            s[i] = '\0';
            p[s[i - 1] - '0'] = temp;
            s[i-1] = '\0';
            temp = s + i + 1;
            ++pos;
        }
    }
    pos++;
    if(pos == 0){
        p[1] = temp;
    }else{
        p[s[lenS-1]-'0'] = temp;
    }
    s[lenS-1] = '\0';
    char* result = (char*)malloc(sizeof(char) * lenS+1);
    if (!result) {
        return NULL;
    }
    memset(result,'\0', lenS+1);
    for (int i = 1; i <= pos; i++) {
        strcat(result, p[i]);
        int len = (int)strlen(result);
        if (i != pos) {
            result[len] = ' ';
        }
    }
    return result;
}

